Skip to content

Allow dcp interchange to scanout interchange compressed#449

Open
oliverbestmann wants to merge 3924 commits intoAsahiLinux:asahifrom
oliverbestmann:asahi-dcp-interchange
Open

Allow dcp interchange to scanout interchange compressed#449
oliverbestmann wants to merge 3924 commits intoAsahiLinux:asahifrom
oliverbestmann:asahi-dcp-interchange

Conversation

@oliverbestmann
Copy link
Copy Markdown

Copy link
Copy Markdown
Member

@Conan-Kudo Conan-Kudo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The UAPI change needs to be separately contributed to Linux directly, not this fork.

See this documentation: https://docs.kernel.org/process/submitting-patches.html

Comment thread include/uapi/drm/drm_fourcc.h Outdated
*/
#define DRM_FORMAT_MOD_APPLE_GPU_TILED fourcc_mod_code(APPLE, 1)
#define DRM_FORMAT_MOD_APPLE_GPU_TILED_COMPRESSED fourcc_mod_code(APPLE, 2)
#define DRM_FORMAT_MOD_APPLE_INTERCHANGE_COMPRESSED fourcc_mod_code(APPLE, 3)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For experimenting we should move this into the driver with

#ifndef DRM_FORMAT_MOD_APPLE_INTERCHANGE_COMPRESSED
#define DRM_FORMAT_MOD_APPLE_INTERCHANGE_COMPRESSED fourcc_mod_code(APPLE, 3)
#endif

I'm not sure if we want one or more APPLE_INTERCHANGE_COMPRESSED modifiers to handle YCbCr formats which use 32x32 tiles for Y

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this enough of a difference to warrant a new format modifier? If the tile size only changes for the luma channel of Y'CbCr textures, can we not just handle that by checking is_yuv for the framebuffer format info struct? E.g.

tile_w = fb->format->is_yuv ? 32 : 16

@jannau jannau force-pushed the asahi-wip branch 2 times, most recently from 0031cb6 to 79a307d Compare February 14, 2026 20:09
@waltmck
Copy link
Copy Markdown

waltmck commented Feb 23, 2026

Thank you for the exciting work!

I tested this with nixos-apple-silicon 6.10 using your flake, on an M2 Macbook Air. Hyprland fails to launch with the following repeated log message:

kernel: apple-dcp 231c00000.dcp: swap failed! status 4
kernel: dcp: plane 0 modifiers: c00000000000003
kernel: apple-dcp 231c00000.dcp: RTKit: syslog message: UPPipe.cpp:3920: IOMFB verify_uc_surface: Planesize insufficient for data plane size 17039360, data size 17301504
kernel: apple-dcp 231c00000.dcp: RTKit: syslog message: UPPipeDCP_H13P.cpp:4554: bool IOMFB::UPPipeDCP_H13P::verify_surfaces(IOMFB::SwapRequest *): Error with the interchange surface
kernel: apple-dcp 231c00000.dcp: RTKit: syslog message: FramebufferDCP.cpp:2175: AppleCLCD: verify_swap failed for swap id: 4285

@oliverbestmann oliverbestmann force-pushed the asahi-dcp-interchange branch 3 times, most recently from 368641c to cdeaea6 Compare February 24, 2026 11:19
@oliverbestmann
Copy link
Copy Markdown
Author

@waltmck

I tested this with nixos-apple-silicon 6.10 using your flake, on an M2 Macbook Air.

Thank you. Is that with the notch enabled or disabled? And what's your selected display resolution?

It was not working with hyprland on my machine too. I've fixed the issue now. Please try again with the latest update to the flake.

@waltmck
Copy link
Copy Markdown

waltmck commented Feb 25, 2026

@waltmck

I tested this with nixos-apple-silicon 6.10 using your flake, on an M2 Macbook Air.

Thank you. Is that with the notch enabled or disabled? And what's your selected display resolution?

It was not working with hyprland on my machine too. I've fixed the issue now. Please try again with the latest update to the flake.

With your latest flake I can run Hyprland (and I've been using it to work for the last few hours without issues). Is there an easy way to check with certainty that compressed scanout is actually being used?

@oliverbestmann
Copy link
Copy Markdown
Author

You can use drm_info to see that modifier c00000000000003 is used for the plane.

@waltmck
Copy link
Copy Markdown

waltmck commented Feb 25, 2026

You can use drm_info to see that modifier c00000000000003 is used for the plane.

yep, I do see that so it seems to be working.

masneyb and others added 16 commits February 26, 2026 14:59
…vider_ro_determine_rate()

[ Upstream commit 349f02c ]

The divider_ro_round_rate() function is now deprecated, so let's migrate
to divider_ro_determine_rate() instead so that this deprecated API can
be removed.

Note that when the main function itself was migrated to use
determine_rate, this was mistakenly converted to:

    req->rate = divider_round_rate(...)

This is invalid in the case when an error occurs since it can set the
rate to a negative value.

Fixes: b6f9051 ("clk: qcom: regmap-divider: convert from round_rate() to determine_rate()")
Signed-off-by: Brian Masney <bmasney@redhat.com>
Reviewed-by: Abel Vesa <abel.vesa@oss.qualcomm.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20260108-clk-divider-round-rate-v1-15-535a3ed73bf3@redhat.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
…er_determine_rate()

[ Upstream commit d8300e6 ]

The divider_round_rate() function is now deprecated, so let's migrate
to divider_determine_rate() instead so that this deprecated API can be
removed.

Note that when the main function itself was migrated to use
determine_rate, this was mistakenly converted to:

    req->rate = divider_round_rate(...)

This is invalid in the case when an error occurs since it can set the
rate to a negative value.

Fixes: b6f9051 ("clk: qcom: regmap-divider: convert from round_rate() to determine_rate()")
Signed-off-by: Brian Masney <bmasney@redhat.com>
Reviewed-by: Abel Vesa <abel.vesa@oss.qualcomm.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20260108-clk-divider-round-rate-v1-16-535a3ed73bf3@redhat.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
[ Upstream commit a1d6349 ]

Add CLK_OPS_PARENT_ENABLE to MDSS pixel clock sources to ensure parent
clocks are enabled during clock operations, preventing potential
stability issues during display configuration.

Fixes: 8135177 ("clk: qcom: Add display clock controller driver for SDM845")
Signed-off-by: Petr Hodina <petr.hodina@protonmail.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: David Heidelberg <david@ixit.cz>
Link: https://lore.kernel.org/r/20260107-stability-discussion-v2-1-ef7717b435ff@protonmail.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
[ Upstream commit fab13d7 ]

Set CLK_OPS_PARENT_ENABLE to ensure the parent gets prepared and enabled
when switching to it.

Fixes: e3c13e0 ("clk: qcom: dispcc-sm7150: Fix dispcc_mdss_pclk0_clk_src")
Signed-off-by: David Heidelberg <david@ixit.cz>
Link: https://lore.kernel.org/r/20260117-sm7150-dispcc-fix-v1-1-2f39966bcad2@ixit.cz
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
[ Upstream commit 2583cb9 ]

After commit d228ece ("clk: divider: remove round_rate() in favor
of determine_rate()") determining GFX3D clock rate crashes, because the
passed parent map doesn't provide the expected best_parent_hw clock
(with the roundd_rate path before the offending commit the
best_parent_hw was ignored).

Set the field in parent_req in addition to setting it in the req,
fixing the crash.

 clk_hw_round_rate (drivers/clk/clk.c:1764) (P)
 clk_divider_bestdiv (drivers/clk/clk-divider.c:336)
 divider_determine_rate (drivers/clk/clk-divider.c:358)
 clk_alpha_pll_postdiv_determine_rate (drivers/clk/qcom/clk-alpha-pll.c:1275)
 clk_core_determine_round_nolock (drivers/clk/clk.c:1606)
 clk_core_round_rate_nolock (drivers/clk/clk.c:1701)
 __clk_determine_rate (drivers/clk/clk.c:1741)
 clk_gfx3d_determine_rate (drivers/clk/qcom/clk-rcg2.c:1268)
 clk_core_determine_round_nolock (drivers/clk/clk.c:1606)
 clk_core_round_rate_nolock (drivers/clk/clk.c:1701)
 clk_core_round_rate_nolock (drivers/clk/clk.c:1710)
 clk_round_rate (drivers/clk/clk.c:1804)
 dev_pm_opp_set_rate (drivers/opp/core.c:1440 (discriminator 1))
 msm_devfreq_target (drivers/gpu/drm/msm/msm_gpu_devfreq.c:51)
 devfreq_set_target (drivers/devfreq/devfreq.c:360)
 devfreq_update_target (drivers/devfreq/devfreq.c:426)
 devfreq_monitor (drivers/devfreq/devfreq.c:458)
 process_one_work (arch/arm64/include/asm/jump_label.h:36 include/trace/events/workqueue.h:110 kernel/workqueue.c:3284)
 worker_thread (kernel/workqueue.c:3356 (discriminator 2) kernel/workqueue.c:3443 (discriminator 2))
 kthread (kernel/kthread.c:467)
 ret_from_fork (arch/arm64/kernel/entry.S:861)

Fixes: 55213e1 ("clk: qcom: Add gfx3d ping-pong PLL frequency switching")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Abel Vesa <abel.vesa@oss.qualcomm.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Reviewed-by: Brian Masney <bmasney@redhat.com>
Link: https://lore.kernel.org/r/20260117-db820-fix-gfx3d-v1-1-0f8894d71d63@oss.qualcomm.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
…te() to divider_determine_rate()

[ Upstream commit d0b7c5b ]

owl_divider_helper_round_rate() is just a wrapper for
divider_round_rate(), which is deprecated. Let's migrate to
divider_determine_rate() instead so that this deprecated API can be
removed.

Acked-by: Manivannan Sadhasivam <mani@kernel.org>
Signed-off-by: Brian Masney <bmasney@redhat.com>
Stable-dep-of: 3ff3360 ("clk: actions: owl-divider: convert from divider_round_rate() to divider_determine_rate()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
…er_determine_rate()

[ Upstream commit 3ff3360 ]

The divider_round_rate() function is now deprecated, so let's migrate
to divider_determine_rate() instead so that this deprecated API can be
removed. Additionally, owl_divider_helper_round_rate() is no longer used,
so let's drop that from the header file as well.

Note that when the main function itself was migrated to use
determine_rate, this was mistakenly converted to:

    req->rate = divider_round_rate(...)

This is invalid in the case when an error occurs since it can set the
rate to a negative value.

Fixes: 1b04e12 ("clk: actions: owl-divider: convert from round_rate() to determine_rate()")
Acked-by: Manivannan Sadhasivam <mani@kernel.org>
Signed-off-by: Brian Masney <bmasney@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
…ate()

[ Upstream commit 463b97b ]

The divider_round_rate() function is now deprecated, so let's migrate
to divider_determine_rate() instead so that this deprecated API can be
removed.

Note that when the main function itself was migrated to use
determine_rate, this was mistakenly converted to:

    req->rate = divider_round_rate(...)

This is invalid in the case when an error occurs since it can set the
rate to a negative value.

Fixes: 64613d7 ("clk: bm1880: convert from round_rate() to determine_rate()")
Acked-by: Manivannan Sadhasivam <mani@kernel.org>
Signed-off-by: Brian Masney <bmasney@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
…to divider_determine_rate()

[ Upstream commit e3a5249 ]

The divider_round_rate() function is now deprecated, so let's migrate
to divider_determine_rate() instead so that this deprecated API can be
removed.

Note that when the main function itself was migrated to use
determine_rate, this was mistakenly converted to:

    req->rate = divider_round_rate(...)

This is invalid in the case when an error occurs since it can set the
rate to a negative value.

Fixes: 619a621 ("clk: hisilicon: clkdivider-hi6220: convert from round_rate() to determine_rate()")
Signed-off-by: Brian Masney <bmasney@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
…e_rate()

[ Upstream commit 11d3c67 ]

The divider_round_rate() function is now deprecated, so let's migrate
to divider_determine_rate() instead so that this deprecated API can be
removed.

Note that when the main function itself was migrated to use
determine_rate, this was mistakenly converted to:

    req->rate = divider_round_rate(...)

This is invalid in the case when an error occurs since it can set the
rate to a negative value.

Fixes: bb40a2e ("clk: loongson1: convert from round_rate() to determine_rate()")
Reviewed-by: Keguang Zhang <keguang.zhang@gmail.com>
Tested-by: Keguang Zhang <keguang.zhang@gmail.com> # on LS1B & LS1C
Signed-off-by: Brian Masney <bmasney@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
…_rate()

[ Upstream commit 865e63b ]

The divider_round_rate() function is now deprecated, so let's migrate
to divider_determine_rate() instead so that this deprecated API can be
removed.

Note that when the main function itself was migrated to use
determine_rate, this was mistakenly converted to:

    req->rate = divider_round_rate(...)

This is invalid in the case when an error occurs since it can set the
rate to a negative value.

Fixes: 7b45988 ("clk: milbeaut: convert from round_rate() to determine_rate()")
Signed-off-by: Brian Masney <bmasney@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
…vider_determine_rate()

[ Upstream commit 9329d78 ]

The divider_round_rate() function is now deprecated, so let's migrate
to divider_determine_rate() instead so that this deprecated API can be
removed.

Note that when the main function itself was migrated to use
determine_rate, this was mistakenly converted to:

    req->rate = divider_round_rate(...)

This is invalid in the case when an error occurs since it can set the
rate to a negative value.

Fixes: 215f8aa ("clk: nuvoton: ma35d1-divider: convert from round_rate() to determine_rate()")
Signed-off-by: Brian Masney <bmasney@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
…mine_rate()

[ Upstream commit af94366 ]

The divider_round_rate() function is now deprecated, so let's migrate
to divider_determine_rate() instead so that this deprecated API can be
removed.

Note that when the main function itself was migrated to use
determine_rate, this was mistakenly converted to:

    req->rate = divider_round_rate(...)

This is invalid in the case when an error occurs since it can set the
rate to a negative value.

Fixes: 0879768 ("clk: nxp: lpc32xx: convert from round_rate() to determine_rate()")
Tested-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Brian Masney <bmasney@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
…der_determine_rate()

[ Upstream commit 77b04dc ]

The divider_round_rate() function is now deprecated, so let's migrate
to divider_determine_rate() instead so that this deprecated API can be
removed.

Note that when the main function itself was migrated to use
determine_rate, this was mistakenly converted to:

    req->rate = divider_round_rate(...)

This is invalid in the case when an error occurs since it can set the
rate to a negative value.

Note that this commit also removes a debugging message that's not really
needed.

Fixes: 9a3b699 ("clk: sophgo: sg2042-clkgen: convert from round_rate() to determine_rate()")
Tested-by: Chen Wang <unicorn_wang@outlook.com>
Reviewed-by: Chen Wang <unicorn_wang@outlook.com>
Signed-off-by: Brian Masney <bmasney@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
…e_rate()

[ Upstream commit f78fb94 ]

The divider_round_rate() function is now deprecated, so let's migrate
to divider_determine_rate() instead so that this deprecated API can be
removed.

Note that when the main function itself was migrated to use
determine_rate, this was mistakenly converted to:

    req->rate = divider_round_rate(...)

This is invalid in the case when an error occurs since it can set the
rate to a negative value.

Fixes: deb4740 ("clk: sprd: div: convert from round_rate() to determine_rate()")
Signed-off-by: Brian Masney <bmasney@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
…er_ro_determine_rate()

[ Upstream commit 6587c9d ]

The divider_ro_round_rate() function is now deprecated, so let's migrate
to divider_ro_determine_rate() instead so that this deprecated API can
be removed.

Note that when the main function itself was migrated to use
determine_rate, this was mistakenly converted to:

    req->rate = divider_round_rate(...)

This is invalid in the case when an error occurs since it can set the
rate to a negative value.

Fixes: cd1cb38 ("clk: stm32: stm32-core: convert from round_rate() to determine_rate()")
Signed-off-by: Brian Masney <bmasney@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
jannau added 15 commits March 1, 2026 08:26
After discussion with the devicetree maintainers we agreed to not extend
lists with the generic compatible "apple,spmi" anymore [1]. Use
"apple,t8103-spmi" as base compatible as it is the SoC the driver and
bindings were written for.

[1]: https://lore.kernel.org/asahi/12ab93b7-1fc2-4ce0-926e-c8141cfe81bf@kernel.org/

Reviewed-by: Neal Gompa <neal@gompa.dev>
Signed-off-by: Janne Grunau <j@jannau.net>
After discussion with the devicetree maintainers we agreed to not extend
lists with the generic compatible "apple,wdt" anymore [1]. Use
"apple,t8103-wdt" as base compatible as it is the SoC the driver and
bindings were written for.

[1]: https://lore.kernel.org/asahi/12ab93b7-1fc2-4ce0-926e-c8141cfe81bf@kernel.org/

Reviewed-by: Neal Gompa <neal@gompa.dev>
Signed-off-by: Janne Grunau <j@jannau.net>
After discussion with the devicetree maintainers we agreed to not extend
lists with the generic compatible "apple,nco" anymore [1]. Use
"apple,t8103-nco" as base compatible as it is the SoC the driver and
bindings were written for.

[1]: https://lore.kernel.org/asahi/12ab93b7-1fc2-4ce0-926e-c8141cfe81bf@kernel.org/

Reviewed-by: Neal Gompa <neal@gompa.dev>
Signed-off-by: Janne Grunau <j@jannau.net>
@jannau
Copy link
Copy Markdown
Member

jannau commented Mar 1, 2026

the code misses a check to ensure the computed surface size for interchange framebuffers fits into the framebuffer's reported buffer size

@oliverbestmann
Copy link
Copy Markdown
Author

the code misses a check to ensure the computed surface size for interchange framebuffers fits into the framebuffer's reported buffer size

Whats the expected behavior in that case? assert and kernel panic, or some logging and quietly ignoring the plane?

@jannau
Copy link
Copy Markdown
Member

jannau commented Mar 1, 2026

the code misses a check to ensure the computed surface size for interchange framebuffers fits into the framebuffer's reported buffer size

Whats the expected behavior in that case? assert and kernel panic, or some logging and quietly ignoring the plane?

check needs to happen in atomic_check where it can fail, possible that there there are drm_format helpers for that using driver specific formats (I would have to check myself)

@chadmed
Copy link
Copy Markdown
Member

chadmed commented Mar 1, 2026

Tested as mostly-working on G14G, G14S and G13S, however overlays are broken on kwin. May be size/alignment related, as fractional scaling factors and certain cursor images (notably the Breeze I-beam) cause framebuffer creation to fail. This is most obvious with the cursor, but may occur with other oddly-sized overlay framebuffers.

@oliverbestmann
Copy link
Copy Markdown
Author

Tested as mostly-working on G14G, G14S and G13S, however overlays are broken on kwin. May be size/alignment related, as fractional scaling factors and certain cursor images (notably the Breeze I-beam) cause framebuffer creation to fail. This is most obvious with the cursor, but may occur with other oddly-sized overlay framebuffers.

Thank you. I had no problems running this with kde. I'll try to reproduce the issues as soon as I can.

@oliverbestmann oliverbestmann force-pushed the asahi-dcp-interchange branch from cdeaea6 to 0ddf41f Compare March 2, 2026 18:00
@oliverbestmann oliverbestmann changed the base branch from asahi-wip to asahi March 2, 2026 18:03
Comment thread drivers/gpu/drm/apple/plane.c Outdated
* The metadata buffer contains 8 bytes per 16x16 compression tile.
* Addressing is fully twiddled, so both width and height are padded to
* powers-of-two.
*/
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the comment from the drm_fourcc.h description would be more more appropriate:

/*
 *  ... The metadata section rounds the image dimensions to
 * powers-of-two and contains 8 bytes for each 16x16 compression subtile.
 * Subtiles are interleaved (Morton order).
 */

It's the most up to date description.

Comment thread drivers/gpu/drm/apple/plane.c Outdated
Comment thread drivers/gpu/drm/apple/plane.c Outdated
Comment thread drivers/gpu/drm/apple/plane.c
Signed-off-by: Oliver Bestmann <oliver.bestmann@googlemail.com>
@oliverbestmann oliverbestmann force-pushed the asahi-dcp-interchange branch from 0ddf41f to 5011f80 Compare March 6, 2026 09:30
Signed-off-by: Oliver Bestmann <oliver.bestmann@googlemail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.